package com.gxa.web_admin.controller.lx;

import com.gxa.common.vo.R2;
import com.gxa.modules.service.lx.GoodsService;
import com.gxa.modules.service.lx.GoodsTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@Api(value = "商品分类",tags = "商品分类")
@RequestMapping("/goodsType")
public class GoodsTypeController {

    @Autowired
    private GoodsTypeService goodsTypeService;

    @PostMapping(value = "/queryGoodsTypeList")
    @ApiOperation(value = "商品分类查询接口",notes = "商品分类查询", response = R2.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R2 queryGoodsTypeList(){

        return goodsTypeService.queryGoodsTypeList();
    }

    @PostMapping(value = "/addGoodsType")
    @ApiOperation(value = "添加商品分类接口",notes = "添加商品分类", response = R2.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R2 addGoodsType(@RequestBody Map map){

        return goodsTypeService.addGoodsType(map);
    }

    @PostMapping(value = "/delGoodsType")
    @ApiOperation(value = "删除商品分类接口",notes = "删除商品分类", response = R2.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R2 delGoodsType(@RequestBody Map map){

        return goodsTypeService.delGoodsType(map);
    }

}
